import { request } from './request';

/**
 * 用户注册
 */
export const userRegister = async (params) => {
  return request({
    url: "/api/user/register",
    method: "POST",
    data: params,
  });
};

/**
 * 用户登录
 */
export const userLogin = async (params) => {
  return request({
    url: "/api/user/login",
    method: "POST",
    data: params,
  });
};

/**
 * 用户注销
 */
export const userLogout = async () => {
  return request({
    url: "/api/user/logout",
    method: "POST",
  });
};

/**
 * 获取当前用户
 */
export const getCurrentUser = async () => {
  return request({
    url: "/api/user/current",
    method: "GET",
  });
};

/**
 * 获取用户列表
 */
export const getUserList = async (pageNum, pageSize, userName, phoneNumber) => {
  return request({
    url: `/api/user/list/${pageNum}/${pageSize}`,
    method: "GET",
    params: {
      userName,
      phoneNumber
    },
  });
};

/**
 * 删除用户
 */
export const deleteUser = async (ids) => {
  return request({
    url: "/api/user/delete",
    method: "POST",
    data: ids
  });
};